package
{
	import br.poli.ecomp.tcc.stimultimidia.ApplicationFacade;
	import br.poli.ecomp.tcc.stimultimidia.event.SpeachEvent;
	import br.poli.ecomp.tcc.stimultimidia.view.components.TelaCadastro;
	import br.poli.ecomp.tcc.stimultimidia.view.components.TelaLogin;
	import br.poli.ecomp.tcc.stimultimidia.view.components.TelaPrincipal;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.NetStatusEvent;
	import flash.net.NetConnection;
	import flash.net.Responder;
	
	[SWF(width='1024', height='768', backgroundColor='#FFFFFF', frameRate='30')]
	public class STIAS3 extends Sprite
	{
		private var zinc:ZincApp;
		
		public var main:TelaPrincipal
		public var login:TelaLogin;
		public var cadastro:TelaCadastro;
		
		public function STIAS3()
		{
			super ();
			this.zinc = new ZincApp()
			this.addChild(this.zinc);
			
			this.addEventListener( SpeachEvent.SPEACH , onSpeach );
			
			
			var evt:SpeachEvent = new SpeachEvent( SpeachEvent.SPEACH , "English textbooks are grade school, middle school, high school, and college textbooks that examine the English language. ");
			
			//this.dispatchEvent( evt );
			
			this.addChild( new BG );
			
			this.login =  new TelaLogin;
			this.main = new TelaPrincipal;
			 this.cadastro = new TelaCadastro;
			
			var app:ApplicationFacade = ApplicationFacade.getInstance();
			app.startup( this );
			
		}
		
		private function onSpeach(e:SpeachEvent):void
		{
			this.zinc.say( e.texto );
		}
		
		
		
		 protected function onMDMinit():void {
			//super.onMDMinit ();
			
			this.dispatchEvent( new Event(Event.INIT ) ); 
			this.addChild( new TelaPrincipal);
			
			
			var  responder:Responder = new Responder( onResult , onFault);
			
			var conn:NetConnection = new NetConnection()
			conn.addEventListener(NetStatusEvent.NET_STATUS,onNetStatus );
			conn.connect("http://192.168.0.250/MediaClass/amfphp/gateway.php");
				
			conn.call("Fachada.getFiles" , responder );
				
			//	myService.call("node.load", responder ,
				//http://192.168.0.105/MediaClass/amfphp/gateway.php
			
		}
		
		private function onResult(e:Object):void
		{
			// TODO Auto Generated method stub
		}
		
		private function onFault(e:Object):void
		{
			// TODO Auto Generated method stub
		}
		
		private function onNetStatus(e:NetStatusEvent):void
		{
			// TODO Auto Generated method stub
		}
		
	}
}